package org.javaboy;

import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

public class Demo08 {
    public static void main(String[] args) {
        List<Integer> list = Arrays.asList(1, 2, 3);
        String s = list.stream().map(String::valueOf).collect(Collectors.joining(","));
        System.out.println("s = " + s);
        Optional<Integer> optional = list.stream().reduce((a, b) -> a + b);
        Integer i = optional.get();
        System.out.println("i = " + i);
    }
}
